package com.chidopi.market.bookstore;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

import com.chidopi.market.bookstore.actions.BookCategoriesAction;
import com.chidopi.market.bookstore.actions.BookCityAction;
import com.chidopi.market.bookstore.actions.BookItemsAction;
import com.chidopi.market.bookstore.actions.BookZipBackupAction;
import com.chidopi.market.bookstore.actions.BrandAction;
import com.chidopi.market.bookstore.actions.CityConfAction;
import com.chidopi.market.bookstore.actions.ContextProviderAction;
import com.chidopi.market.bookstore.actions.DownloadStatAction;
import com.chidopi.market.bookstore.actions.ProductID2BookAction;
import com.chidopi.market.bookstore.actions.Subscribe4iOSAction;
import com.chidopi.market.bookstore.actions.SubscriptionsAction;


@Component("bookstoreAppConfig")
public class AppConfig {
	
	private static Logger logger = LoggerFactory.getLogger(AppConfig.class);
	
	@Bean(name={"/brand",
				"/ajaxBrandQuery",
				"/insertBrand",
				"/updateBrand",
				"/deleteBrand",
				"/saveBrand",})
	public BrandAction brandAction() {
		logger.debug("call login of brandAction");
		return new BrandAction("/brand");
	}
	
	@Bean(name={"/categories",	"/molifecategories",
			"/ajaxCategoriesQuery",
			"/insertCategories",
			"/updateCategories",
			"/deleteCategories",
			"/saveCategories",})
	public BookCategoriesAction bookCateoriesAction() {
		logger.debug("call login of bookCateoriesAction");
		return new BookCategoriesAction("/categories");
	}
	
	@Bean(name={"/contextProvider",
				"/ajaxCPQuery",
				"/insertCP",
				"/updateCP",
				"/deleteCP",
				"/saveCP",})
	public ContextProviderAction contextProviderAction() {
		logger.debug("call login of contextProviderAction");
		return new ContextProviderAction("/contextProvider");
	}
	
	@Bean(name={"/bookitems",	"/molifebookitems",
				"/ajaxBookItemsQuery",
				"/insertBookItems",
				"/updateBookItems",
				"/deleteBookItems",
				"/saveBookItems",
				"/showIcon",
				"/showThumb",
				"/zipDownload",
				"/ajaxCheckBookItem"})
	public BookItemsAction bookitemsAction() {
		logger.debug("call login of bookitemsAction");
		return new BookItemsAction("/bookitems");
	}
	
	@Bean(name={"/bookZipBackups",
			    "/ajaxBackupsQuery",
			    "/deleteBookZipBackup",
			    "/removeBookZipBackup",
			    "/backupDownload"})
	public BookZipBackupAction bookzipBackupAction(){
		logger.debug("call login of bookzipBackupAction");
		return new BookZipBackupAction("/bookZipBackups");
	}
	
	@Bean(name={"/bookCities",
				"/ajaxBookCityQuery",
				"/insertBookCity",
				"/updateBookCity",
				"/deleteBookCity",
				"/saveBookCity",})
	public BookCityAction bookCitiesAction() {
		logger.debug("call login of bookCityAction");
		return new BookCityAction("/bookCities");
	
	}
	
	@Bean(name={"/subscriptions",
				"/ajaxSubscriptionsQuery",
				"/insertSubscription",
				"/updateSubscription",
				"/deleteSubscription",
				"/saveSubscription",})
	public SubscriptionsAction subscriptionsAction() {
		logger.debug("call login of subscriptionsAction");
		return new SubscriptionsAction("/subscriptions");
	}
	
	@Bean(name={"/subscribe4iOS",
				"/ajaxSubscribe4iOSQuery",
				"/insertSubscribe4iOS",
				"/updateSubscribe4iOS",
				"/deleteSubscribe4iOS",
				"/saveSubscribe4iOS",
				"/showPageL",
				"/showPageP",
				"/showSubscribeIcon",
				"/ajaxGetSubscribe"})
	public Subscribe4iOSAction subscribe4iOSAction() {
		logger.debug("call login of Subsrcibe4iOSAction");
		return new Subscribe4iOSAction("/subscribe4iOS");
	}
	
	@Bean(name={"/productID2Book",
				"/ajaxProductID2BookQuery",
				"/insertProductID2Book",
				"/updateProductID2Book",
				"/deleteProductID2Book",
				"/saveProductID2Book",
				"/ajaxValidateProductId",
				"/ajaxValidateBookId",
				"/ajaxGetBooks",
				"/ajaxGetSubscriptions"})
	public ProductID2BookAction productID2BookAction() {
		logger.debug("call login of productID2Book");
		return new ProductID2BookAction("/productID2Book");
	}
	
	@Bean(name={"/downloadStat",
				"/ajaxZipDownLogQuery",
				"/ajaxZipDownLogCSV"})
	public DownloadStatAction downloadStatAction() {
		logger.debug("call login of downloadStatAction");
		return new DownloadStatAction();
	}

	@Bean(name={"/molifeConf",
			"/saveCityConf"})
	public CityConfAction cityConfAction() {
		logger.debug("call login of cityConfAction");
		return new CityConfAction();
	}
}
